//引入Vue 和 Vuex 
import Vue from 'vue'
import Vuex from 'vuex'

//使用Vuex
Vue.use(Vuex)
//创建store 对象 

const store = new Vuex.Store({
	//state中是需要管理的全局变量
	state: {
		userinfo: {},
		needAuth: true,
		isLogin: false,
		jobNumber: '',
		password: '',
		workshow: false,
		usershow: true,
		
	},
	mutations: {
		setJobNumber(state, jobNumber) {
			state.jobNumber = jobNumber
		},
		setPassword(state, password) {
			state.password = password
		},
		setworkshow(state, workshow) {
			state.workshow = workshow
		},
		setusershow(state, usershow) {
			state.usershow = usershow
		},
		
		
	},
	// actions: {
	// 	setJobNumber({
	// 		commit
	// 	}, jobNumber) {
	// 		commit('SET_JOB_NUMBER', jobNumber)
	// 	},
	// 	setPassword({
	// 		commit
	// 	}, password) {
	// 		commit('SET_PASSWORD', password)
	// 	}
	// },
	getters: {
		getJobNumber(state) {
			return state.jobNumber
		},
		getPassword(state) {
			return state.password
		},
		
		getworkshow(state) {
			return state.workshow
		},
		getusershow(state) {
			return state.usershow
		},
	}

})
//导出store
export default store